package cn.jtfadmin.base.dict.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Objects;

/**
 * 字典项目
 *
 * @author jtf
 * @since 0.0.1
 */
@Data
public class DictItemModelDTO implements Serializable {


    public DictItemModelDTO() {
    }

    public DictItemModelDTO(String value, String text) {
        this.value = value;
        this.text = text;
    }

    public DictItemModelDTO( String value, String text, Object source) {
        this.source = source;
        this.value = value;
        this.text = text;
    }

    private Object source;

    /**
     * 字典value
     */
    private String value;
    /**
     * 字典文本
     */
    private String text;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DictItemModelDTO that = (DictItemModelDTO) o;
        return Objects.equals(source, that.source) &&
                Objects.equals(value, that.value) &&
                Objects.equals(text, that.text);
    }

    @Override
    public int hashCode() {
        return Objects.hash(source, value, text);
    }
}
